<?php
$AFSName = array(
	'id'	=>	'AFSName',
	'name'	=>	'AFSName',
	'value'	=>	''
);

$countryOptions = $this->config->item('country', 'adsense');
$localeOptions = $this->config->item('locale', 'adsense');
$encodingOptions = $this->config->item('encoding', 'adsense');
$searchTypeOptions = $this->config->item('searchType', 'adsense');

$domains = array(
	'id'	=>	'domains',
	'name'	=>	'domains',
	'rows'	=>	'2',
	'cols'	=>	'25',
	'value'	=>	''
);

$googleID_SearchAds = array(
	'id'	=>	'googleID',
	'name'	=>	'googleID',
	'value'	=>	$googleID_SearchAds,
	'type'	=>	'hidden'
);

$channelNameOptions = $channelName;

$backgroundColor = array(
	'id'	=>	'backgroundColor',
	'name'	=>	'backgroundColor',
	'value'	=>	'#FFFFFF',
	'class'	=>	'iColorPicker',
	'style' => 'width:70px'
);

$isButtonBelowOptions = $this->config->item('isButtonBelow', 'adsense');
$isLogoAboveOptions = $this->config->item('isLogoAbove', 'adsense');
$logoTypeOptions = $this->config->item('logoType', 'adsense');
$searchStyleNameOptions = $this->config->item('searchStyleName', 'adsense');
$textColorOptions = $this->config->item('textColor', 'adsense');
$showResultsInNewWindowOptions = $this->config->item('showResultsInNewWindow', 'adsense');

$textBoxLength = array(
	'id'	=>	'textBoxLength',
	'name'	=>	'textBoxLength',
	'value'	=>	'55',
);
$this->adgeek_view->backyard_header();

?>
<script language="javascript" type="text/javascript" src="/js/register_form.js"></script>
<div id="content">
   		<div class="mainTitle">
        	<h3>AFS Code Generator</h3>
            <div class="nav">
           	  
            </div>
        </div>
        <div class="main">
            <div class="apply">
                <div>
                <div class="tit">
                	<span class="subTitle">帳戶資訊</span>
                	<p>請先確認帳戶無誤，再進行廣告程式碼產生</p>
                </div>
                <ul>
                	<li>googleID</li>
                    <li class="box">
                    	<?php echo $googleID_SearchAds['value']; ?>
                    </li>
                    <li class="error">
                    	
                    </li>
                </ul>
                <ul>
                	<li>e-mail：</li>
                    <li class="box">
                    	<?php echo $loginEmail; ?>
                    </li>
                    <li class="error">
                    	
                    </li>
                </ul>
                <ul>    
                	<li>
                    	帳號類型：
                    </li>
                    <li class="box">
                    	<?php
                    		$entity_type_arr = $this->config->item('entity_type', 'adsense');
                    		echo $entity_type_arr[$entityType]; 
                    	?>
                   	</li> 
                </ul>
                <ul>
                    <li>網址：</li>
                    <li class="box">
                    	<?php echo $websiteUrl; ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li>廣告類型：</li>
                    <li class="box">
                    	<?php
                    		$syn_service_types_arr = $this->config->item('syn_service_types', 'adsense');
							$synServiceTypes = explode('/', $synServiceTypes);
							end($synServiceTypes);
							$lastKey = key($synServiceTypes);
							
							foreach($synServiceTypes as $key=>$val){
								if($key != $lastKey){
									echo $syn_service_types_arr[$val]."/";
								}
								else echo $syn_service_types_arr[$val];
							}
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li>郵遞區號：</li>
                    <li class="box">
                    	<?php
                    		echo $postalCode;
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li>電話末5碼：</li>
                    <li class="box">
                    	<?php
                    		echo $phone;
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>	
                <ul>
                    <li>修改／新增時間：</li>
                    <li class="box">
                    	<?php
                    		echo $modifiedTime;
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>		
                <ul> 
                    <li>使用者偏好語言：</li>
                    <li class="box">
                    	<?php
                    		$users_preferred_locale_arr = $this->config->item('users_preferred_locale', 'adsense');
                    		echo $users_preferred_locale_arr[$usersPreferredLocale]; 
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li>網站內容語言：</li>
                    <li class="box">
                    	<?php
                    		$website_locale_arr = $this->config->item('website_locale', 'adsense');
                    		echo $website_locale_arr[$websiteLocale]; 
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul class="last">
                    <li>是否願意收到Google提供的產品和服務相關資訊：</li>
                    <li class="box">
                    	<?php
                    		echo ($emailPromotionPreferences=='true')?'是':'否'; 
                    	?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul class="first">
                	<li><span>*</span>為必填欄位</li>
                </ul>
                <div class="tit">
                	<span class="subTitle">廣告程式碼</span>
                	<p>注意！廣告程式碼產生後，此程式碼即會建立於此帳戶中</p>
                </div>
                <ul>
                    <li><span>*</span>名稱（管理用）：</li>
                    <li class="box">
                    	<?php echo form_input($AFSName); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>Google ID：</li>
                    <li class="box">
                    	<?php echo $googleID_SearchAds['value']; ?>
                    	<?php echo form_input($googleID_SearchAds); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>國家/地區：</li>
                    <li class="box">
                    	<?php echo form_dropdown('country',$countryOptions,'TW','id="country"'); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>網站語言：</li>
                    <li class="box">
                    	<?php echo form_dropdown('locale',$localeOptions,'zh_TW','id="locale"'); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>編碼：</li>
                    <li class="box">
                    	<?php echo form_dropdown('encoding',$encodingOptions,'big5','id="encoding"'); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>搜尋內容：</li>
                    <li class="box">
                    	<?php echo form_dropdown('searchType',$searchTypeOptions,'GoogleSiteSearch','id="searchType"'); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>網站清單：</li>
                    <li class="box">
                    	<?php echo form_textarea($domains); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li><span>*</span>搜尋框樣式：</li>
                </ul>
               	<ul class="colorPicker">
                    <li class="box">
                    	搜尋框背景色：<?php echo form_input($backgroundColor); ?>
                    	<a href="javascript:void(null)" id="icp_backgroundColor" onclick="iColorShow('backgroundColor','icp_backgroundColor')"><img src="/images/choice_btn.jpg" style="border:0;margin:0 0 0 3px" align="absmiddle" /></a>
                    </li>
                </ul>
                <ul class="colorPicker">
                    <li class="box">
                    	按鈕在查詢文字方塊下方還是側邊：<?php echo form_dropdown('isButtonBelow',$isButtonBelowOptions,'false','id=isButtonBelow'); ?>
                    </li>
                </ul>
                <ul class="colorPicker">
                    <li class="box">
                    	標誌在查詢文字方塊上方還是側邊：<?php echo form_dropdown('isLogoAbove',$isLogoAboveOptions,'true','id=isLogoAbove'); ?>
                    </li>
                </ul>
                <ul class="colorPicker">
                    <li class="box">
                    	Logo類型：<?php echo form_dropdown('logoType',$logoTypeOptions,'GoogleLogo','id=logoType'); ?>
                    </li>
                </ul>
                <ul class="colorPicker">
                    <li class="box">
                    	內建搜尋樣式名稱：<?php echo form_dropdown('searchStyleName',$searchStyleNameOptions,'Neutral Blend','id=searchStyleName'); ?>
                    </li>
                </ul>
                <ul class="colorPicker">
                    <li class="box">
                    	網站搜尋中網域的文字顏色：<?php echo form_dropdown('textColor',$textColorOptions,'black','id=textColor'); ?>
                    </li>
                </ul>
                <ul class="colorPicker">
                    <li class="box">
                    	文字方塊長度：<?php echo form_input($textBoxLength); ?>
                    </li>
                </ul>
                <ul>
                    <li>自訂廣告頻道：</li>
                    <li class="box">
                    	<?php echo form_dropdown('channelName',$channelNameOptions,'','id="channelName"'); ?>&nbsp;<a href="javascript:;" onclick="createAfsChannelForm()">新增</a>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <ul>
                    <li>搜尋結果：</li>
                    <li class="box">
                    	<?php echo form_dropdown('showResultsInNewWindow',$showResultsInNewWindowOptions,'','id="showResultsInNewWindow"'); ?>
                    </li>
                    <li class="error">
                    </li>
                </ul>
                <div class="tit">
                	<p style="font-size:11px;">用來追蹤此網頁統計資料的頻道。頻道類型必須屬於自訂。如果沒有要指定的頻道，請留空</p>
                </div>
               </div>
        	</div>
        	<div class="legal">
                <ul>
                    <li class="confirm_submit"><a href="javascript:;" onclick="saveSearchBoxStyle('false')"  title="儲存" class="btn btn_blue">儲存</a>
                    <a href="javascript:;" onclick="saveSearchBoxStyle('true');"  title="儲存並取得" class="btn btn_blue">儲存並取得</a>
                    <span id="loading" style="display:none;"><img src="/images/ajax-loader-circle.gif" /></span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
<?php
$this->adgeek_view->footer();
?>